<?php

session_start();

if (isset($_SESSION['user_id']) && $_SESSION['spec_captcha']===false){

    $data = array(
        'type' => $_REQUEST['flag'],  // 0|1
        'name' => $_REQUEST['name'],
        'link' => $_REQUEST['link'],
        'type_content' => $_REQUEST['type']
    );

    include_once "../../../classes/cms_admin.php";
    $CMS_A = new cms_admin();
    $flag = $CMS_A->add_new_item($_REQUEST['id'], $data);

    $result = array(
        'error' => 0,
        'flag'  => $flag,
    );

}else{
    $result = array(
        'error' => 1,
        'description' => "no auth"
    );
}

echo json_encode($result);